package com.mxw.leetcode.D2动态规划;

import com.mxw.leetcode.C1二叉树.entity.TreeNode;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;

public class D00Main {

    Queue<TreeNode> queue = new LinkedList<>();

    void levelTraverse(TreeNode root){

        if (root==null){
            return;
        }

        queue.offer(root);

        while (!queue.isEmpty()){
            int size = queue.size();
            for (int i = 0; i < size; i++) {
                TreeNode node = queue.poll();
                TreeNode left = node.left;
                if (left!=null){
                    queue.offer(root);
                }
                TreeNode right = node.right;
                if (right!=null){
                    queue.offer(right);
                }
            }


        }
    }

}
